package com.app.model;

import org.hibernate.annotations.GenericGenerator;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * Created with IntelliJ IDEA.
 * User: cnprinces
 * Date: 13-1-19
 * Time: 上午10:12
 * To change this template use File | Settings | File Templates.
 */

/**
 * 资源菜单
 */
@Entity
@Table(name = "ORG_Resources")
public class ORG_Resources implements Serializable {
    @Id
    @GenericGenerator(name = "ResGenerator", strategy = "native") //这个是hibernate的注解
    @GeneratedValue(generator = "ResGenerator") //使用uuid的生成策略
    private Integer id;
    private Integer parentId;
    private String resName;
    private String resUrl;
    private String sort;  //现在起的作用是唯一标识，在首页的框架和json的时候能够用到。
    private Integer remTag;  //逻辑删除


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getSort() {
        return sort;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }

    public String getResUrl() {
        return resUrl;
    }

    public void setResUrl(String resUrl) {
        this.resUrl = resUrl;
    }

    public String getResName() {
        return resName;
    }

    public void setResName(String resName) {
        this.resName = resName;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ORG_Resources that = (ORG_Resources) o;

        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (parentId != null ? !parentId.equals(that.parentId) : that.parentId != null) return false;
        if (remTag != null ? !remTag.equals(that.remTag) : that.remTag != null) return false;
        if (resName != null ? !resName.equals(that.resName) : that.resName != null) return false;
        if (resUrl != null ? !resUrl.equals(that.resUrl) : that.resUrl != null) return false;
        if (sort != null ? !sort.equals(that.sort) : that.sort != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (parentId != null ? parentId.hashCode() : 0);
        result = 31 * result + (resName != null ? resName.hashCode() : 0);
        result = 31 * result + (resUrl != null ? resUrl.hashCode() : 0);
        result = 31 * result + (sort != null ? sort.hashCode() : 0);
        result = 31 * result + (remTag != null ? remTag.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "ORG_Resources{" +
                "id=" + id +
                ", parentId=" + parentId +
                ", resName='" + resName + '\'' +
                ", resUrl='" + resUrl + '\'' +
                ", sort='" + sort + '\'' +
                ", remTag=" + remTag +
                '}';
    }
}
